﻿using System;
using System.IO;

namespace Mono.Cecil.PE
{
	// Token: 0x020000EC RID: 236
	internal class BinaryStreamWriter : BinaryWriter
	{
		// Token: 0x170002B7 RID: 695
		// (get) Token: 0x06000974 RID: 2420 RVA: 0x0002A3D4 File Offset: 0x000285D4
		// (set) Token: 0x06000975 RID: 2421 RVA: 0x000056B5 File Offset: 0x000038B5
		public int Position
		{
			get
			{
				return (int)this.BaseStream.Position;
			}
			set
			{
				this.BaseStream.Position = (long)value;
			}
		}

		// Token: 0x06000976 RID: 2422 RVA: 0x000056C6 File Offset: 0x000038C6
		public BinaryStreamWriter(Stream stream) : base(stream)
		{
		}

		// Token: 0x06000977 RID: 2423 RVA: 0x000056D1 File Offset: 0x000038D1
		public void WriteByte(byte value)
		{
			this.Write(value);
		}

		// Token: 0x06000978 RID: 2424 RVA: 0x000056DC File Offset: 0x000038DC
		public void WriteUInt16(ushort value)
		{
			this.Write(value);
		}

		// Token: 0x06000979 RID: 2425 RVA: 0x000056E7 File Offset: 0x000038E7
		public void WriteInt16(short value)
		{
			this.Write(value);
		}

		// Token: 0x0600097A RID: 2426 RVA: 0x000056F2 File Offset: 0x000038F2
		public void WriteUInt32(uint value)
		{
			this.Write(value);
		}

		// Token: 0x0600097B RID: 2427 RVA: 0x000056FD File Offset: 0x000038FD
		public void WriteInt32(int value)
		{
			this.Write(value);
		}

		// Token: 0x0600097C RID: 2428 RVA: 0x00005708 File Offset: 0x00003908
		public void WriteUInt64(ulong value)
		{
			this.Write(value);
		}

		// Token: 0x0600097D RID: 2429 RVA: 0x00005713 File Offset: 0x00003913
		public void WriteBytes(byte[] bytes)
		{
			this.Write(bytes);
		}

		// Token: 0x0600097E RID: 2430 RVA: 0x0000571E File Offset: 0x0000391E
		public void WriteDataDirectory(DataDirectory directory)
		{
			this.Write(directory.VirtualAddress);
			this.Write(directory.Size);
		}

		// Token: 0x0600097F RID: 2431 RVA: 0x0000573B File Offset: 0x0000393B
		public void WriteBuffer(ByteBuffer buffer)
		{
			this.Write(buffer.buffer, 0, buffer.length);
		}

		// Token: 0x06000980 RID: 2432 RVA: 0x00005752 File Offset: 0x00003952
		protected void Advance(int bytes)
		{
			this.BaseStream.Seek((long)bytes, SeekOrigin.Current);
		}

		// Token: 0x06000981 RID: 2433 RVA: 0x0002A3F4 File Offset: 0x000285F4
		public void Align(int align)
		{
			align--;
			int position = this.Position;
			int num = (position + align & ~align) - position;
			for (int i = 0; i < num; i++)
			{
				this.WriteByte(0);
			}
		}
	}
}
